// main.qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import DataProcessor 1.0

Item {
    width: 640
    height: 480
    visible: true

    DataProcessor {
        id: processor

        onDataProcessed: {
            console.log("数据处理完成:", result)
        }
    }

    Column {
        anchors.centerIn: parent
        spacing: 10

        TextField {
            id: inputField
            placeholderText: "输入数据"
        }

        Button {
            text: "处理数据"
            onClicked: {
                var result = processor.processData(inputField.text)
                outputText.text = result
            }
        }

        Text {
            id: outputText
            text: "处理结果会显示在这里"
        }
    }
}
